package controller;



import model.Question;

import org.zkoss.bind.annotation.ExecutionArgParam;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.select.SelectorComposer;
import org.zkoss.zk.ui.select.annotation.Listen;
import org.zkoss.zk.ui.select.annotation.Wire;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Textbox;

import admin.dao.QuestionDAO;



public class AddQuestionCtrl extends SelectorComposer<Component>{
	private static final long serialVersionUID = 1L;

	@Wire
    private Textbox txtQuestion;
	@Wire
	private Textbox txtA;
	@Wire
	private Textbox txtB;
	@Wire
	private Textbox txtC;
	@Wire
	private Textbox txtD;
	@Wire
	private Combobox answers;
	@Wire
	private Textbox examid;
	
	@Listen("onClick = #btSubmit")
    public void submit(){
		System.out.println(this.examid+"examid");
			QuestionDAO.addQuestion(new Question(0, examid.getValue(), txtQuestion.getValue(), txtA.getValue(), txtB.getValue(), txtC.getValue(), txtD.getValue(), answers.getSelectedItem().getValue().toString()));
			Clients.showNotification("Add Question Success !!!");
    }
}
